/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cafe.Model.Utility;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;

/**
 *
 * @author HoangLong
 */
public class LoadServerConfig {
    public static List<String> loadConfigServer() {
        List<String> result = new LinkedList<>();
        Properties prop = new Properties();

        String fileName = "config/server-connection.properties";
        try {
            InputStream is = new FileInputStream(fileName);
            prop.load(is);
            is.close();
        } catch (FileNotFoundException ex) {
            java.util.logging.Logger.getLogger(LoadServerConfig.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            java.util.logging.Logger.getLogger(LoadServerConfig.class.getName()).log(Level.SEVERE, null, ex);
        }

        String server = prop.getProperty("sv.server");
        String port = prop.getProperty("sv.port");
        
        result.add(server);
        result.add(port);
        
        return result;
    }
}
